<template>
  <div>
    <!-- 找服务 -->
    <div
      style="display: flex; justify-content: space-between; padding: 19px 20px"
    >
      <img
        :src="source.coverPhoto"
        style="
          width: 31%;
          cursor: pointer;
          height: 85px;
          object-fit: contain;
          background-color: rgb(209 204 204 / 20%);
        "
        @click="housedetails(source)"
        alt
      />
      <div
        style="
          width: 50%;
          display: flex;
          flex-direction: column;
          justify-content: space-between;
          cursor: pointer;
        "
        @click="housedetails(source)"
      >
        <div
          style="
            color: #333333;
            font-size: 18px;
            font-weight: 600;
            cursor: pointer;
          "
          @click.stop="housedetails(source)"
        >
          {{ source.shopName }}
        </div>
        <div class="fuwjs">
          {{ source.entryName }}
        </div>
        <div style="flex-grow: 1"></div>
        <div class="dizhi line3">
          {{ source.entryDescription }}
        </div>
      </div>
      <div style="width: 6%"></div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    index: {
      type: Number,
    },
    source: {
      type: Object,
      default() {
        return {};
      },
    },
  },
  data() {
    return {};
  },
  methods: {
    housedetails(item) {
      if (item.transactionType == 1) {
        const routeLink = this.$router.resolve({
          path: "/index/leaseDetails?id=" + item.id,
        });
        window.open(routeLink.href, "_blank");
      } else {
        const routeLink = this.$router.resolve({
          path: "/index/serviceDetails?id=" + item.id,
        });
        window.open(routeLink.href, "_blank");
      }
    },
    toAgent(id) {
      const routeLink = this.$router.resolve({
        path: "/index/goldConsultant?id=" + id,
      });
      window.open(routeLink.href, "_blank");
    },
    shopdetails(item) {
      if (item.hasOwnProperty("shopId") && item.shopId != "") {
        const routeLink = this.$router.resolve({
          path: "/index/ShopDetails?id=" + item.shopId,
        });
        window.open(routeLink.href, "_blank");
      } else {
        this.$message({
          message: "个人房源！",
          type: "error",
          offset: 120,
          duration: 2000,
        });
      }
    },
  },
};
</script>

<style lang="less" scoped>
.fuwjs {
  font-size: 14px;
  font-weight: 400;
  color: #64b6a8;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.dizhi {
  font-size: 14px;
  font-weight: 400;
  color: #666666;
}
</style>